//
//  MovieListCell.m
//  UI_豆瓣
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieListCell.h"
#import "UIImageView+WebCache.h"

@interface MovieListCell ()

@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UIImageView *headImageView;
@property (nonatomic, retain)UIImageView *bigImageView;
@end

#define  FULLERAME [[UIScreen mainScreen]bounds]
@implementation MovieListCell

- (void)dealloc
{
    [_bigImageView release];
    [_myMovie release];
    [_nameLabel release];
    [_headImageView release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews
{
    
    
    self.bigImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, 355, 130)];
    self.bigImageView.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self.contentView addSubview:self.bigImageView];
    [_bigImageView release];
    
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(90, 40, 260, 40)];
    self.nameLabel.font = [UIFont boldSystemFontOfSize:25];
    self.nameLabel.numberOfLines = 0;
    [self.bigImageView addSubview:self.nameLabel];
    [_nameLabel release];
    
    
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 70, 67*(FULLERAME.size.height/FULLERAME.size.width))];
    //裁掉view的边界
    self.headImageView.layer.masksToBounds = YES;
    //设置半径
    self.headImageView.layer.cornerRadius = 10;
    //设置边框宽度
//    self.headImageView.layer.borderWidth = 3;
//    //设置边框颜色
//    self.headImageView.layer.borderColor = [UIColor yellowColor].CGColor;
    [self.bigImageView addSubview:self.headImageView];
    [_headImageView release];

}

-(void)setMyMovie:(Movie *)myMovie
{
    if (_myMovie != myMovie) {
        [_myMovie release];
        _myMovie = [myMovie retain];
    }
    self.nameLabel.text = self.myMovie.movieName;
    
       NSURL *url = [NSURL URLWithString:self.myMovie.pic_url];
    
    [self.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"Movie111.png"]];
    
}














- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
